USE SQLExpress

DELETE Currency 
FROM Currency
LEFT OUTER JOIN (
   SELECT MIN(Currency.Id) as RowId
   FROM Currency 
   GROUP BY Name
) as KeepRows ON
   Currency.Id = KeepRows.RowId
WHERE
   KeepRows.RowId IS NULL

DELETE MeasureWeight 
FROM MeasureWeight
LEFT OUTER JOIN (
   SELECT MIN(MeasureWeight.Id) as RowId
   FROM MeasureWeight 
   GROUP BY MeasureWeight.Name
) as KeepRows ON
   MeasureWeight.Id = KeepRows.RowId
WHERE
   KeepRows.RowId IS NULL

DELETE ShippingMethod 
FROM ShippingMethod
LEFT OUTER JOIN (
   SELECT MIN(ShippingMethod.Id) as RowId
   FROM ShippingMethod 
   GROUP BY ShippingMethod.Name
) as KeepRows ON
   ShippingMethod.id = KeepRows.RowId
WHERE
   KeepRows.RowId IS NULL
   
   
DELETE MeasureDimension 
FROM MeasureDimension
LEFT OUTER JOIN (
   SELECT MIN(MeasureDimension.Id) as RowId
   FROM MeasureDimension 
   GROUP BY MeasureDimension.Name
) as KeepRows ON
   MeasureDimension.id = KeepRows.RowId
WHERE
   KeepRows.RowId IS NULL
   
DELETE Country 
FROM Country
LEFT OUTER JOIN (
   SELECT MIN(Country.Id) as RowId
   FROM Country 
   GROUP BY Country.Name
) as KeepRows ON
   Country.id = KeepRows.RowId
WHERE
   KeepRows.RowId IS NULL
   
DELETE TaxCategory 
FROM TaxCategory
LEFT OUTER JOIN (
   SELECT MIN(TaxCategory.Id) as RowId
   FROM TaxCategory 
   GROUP BY TaxCategory.Name
) as KeepRows ON
   TaxCategory.id = KeepRows.RowId
WHERE
   KeepRows.RowId IS NULL
   
DELETE CustomerRole 
FROM CustomerRole
LEFT OUTER JOIN (
   SELECT MIN(CustomerRole.Id) as RowId
   FROM CustomerRole 
   GROUP BY CustomerRole.Name
) as KeepRows ON
   CustomerRole.id = KeepRows.RowId
WHERE
   KeepRows.RowId IS NULL

DELETE [Language]
FROM [Language]
LEFT OUTER JOIN (
   SELECT MIN([Language].Id) as RowId
   FROM [Language]
   GROUP BY [Language].Name
) as KeepRows ON
   [Language].id = KeepRows.RowId
WHERE
   KeepRows.RowId IS NULL
